﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Windows.Forms;

namespace SatisKarsilastirma
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Sessions.Get.OpenSession();
            bool calisiyor;
            Mutex Mtx = new Mutex(true, "SatisKarsilastirma", out calisiyor);
            if (!calisiyor)
            {
                MessageBox.Show("Program çalışıyor.");
                return;
            }
            GC.KeepAlive(Mtx);

            if (!File.Exists(Application.StartupPath + "\\ayarlar.ini"))
            {
                frmAyarlar ayar = new frmAyarlar();
                if (ayar.ShowDialog() == DialogResult.OK)
                    Application.Exit();
            }
            else
            {
                Application.Run(new frmMain());
            }

            Sessions.Get.CloseSession();
        }
    }
}
